package com.ch.roomdemo

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

@Database(entities = [Pension::class], version = 1, exportSchema = false)
abstract class MyDataBase : RoomDatabase() {
    abstract fun getPensionDao(): PensionDao

    companion object {
//        val instance = Single.sin

        val sin: MyDataBase = Room.databaseBuilder(
            MyApp.instance(),
            MyDataBase::class.java,
            "Pension.db"
        ).allowMainThreadQueries()
            .build()
    }

    private object Single {
        val sin: MyDataBase = Room.databaseBuilder(
            MyApp.instance(),
            MyDataBase::class.java,
            "User.db"
        ).allowMainThreadQueries()
            .build()
    }
}